//
//  LTAccountCancellationVC.m
//  Learn
//
//  Created by zyl_macbookpro on 2024/4/1.
//  Copyright © 2024 迟建国. All rights reserved.
//

#import "LTAccountCancellationVC.h"

@interface LTAccountCancellationVC ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic ,strong)UITableView *tableView;

@property(nonatomic ,strong)UIView *tableHeaderView;

@property(nonatomic ,strong)UIView *tableFootorView;

@property(nonatomic ,strong)UILabel *numLabel;


@end

@implementation LTAccountCancellationVC
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self renderNavBarWithBackgroundImage:[UIImage imageWithColor:LTWhiteColor] backgroundColor:LTClearColor shadowColor:nil textAttributeDic:@{NSForegroundColorAttributeName:rgba(0, 0, 0, 1),NSFontAttributeName:MFontWithSize(17)} enableScrollEdgeAppearance:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"注销账号";
    // Do any additional setup after loading the view.
    [self setBackButtonIsHidden:NO];
    [self.view addSubview:self.tableView];
    [self.tableView reloadData];
    self.view.backgroundColor = LTWhiteColor;
 
}


#pragma mark -UITableViewDelegate,UITableViewDelegate
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;
    
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
        cell.selectionStyle =UITableViewCellSelectionStyleNone;
    }

    return cell;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 0;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 55;
    
}


#pragma mark -getters and setters
-(UITableView *)tableView{
    if (!_tableView){
        _tableView =[[UITableView alloc] initWithFrame:CGRectMake(0, LTTopBarHeight, LTScreenWidth, LTScreenHeight - LTTopBarHeight) style:UITableViewStylePlain];
        [_tableView setDelegate:self];
        [_tableView setDataSource:self];
        _tableView.bounces = NO;
        [_tableView setBackgroundColor:LTWhiteColor];
        [_tableView setSeparatorColor:LTSeparatorColor];
        [_tableView setSeparatorInset:UIEdgeInsetsMake(0, 20, 0, 20)];
        _tableView.layer.cornerRadius = 12;
        _tableView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:50/255.0 blue:83/255.0 alpha:0.0500].CGColor;
        _tableView.layer.shadowOffset = CGSizeMake(0,2);
        _tableView.layer.shadowOpacity = 1;
        _tableView.layer.shadowRadius = 12;
        [_tableView setTableFooterView:self.tableFootorView];
        [_tableView setTableHeaderView:self.tableHeaderView];
    }
    
    return _tableView;
}
-(UIView *)tableFootorView
{
    if (!_tableFootorView)
    {
        _tableFootorView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, LTScreenWidth, 146)];
        _tableFootorView.backgroundColor = LTClearColor;
        
        UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(32, 20, LTScreenWidth - 64, 128)];
        bgView.backgroundColor = LTViewBgGray;
        [bgView setAllCornersWithCornerRadius:12];

        NSString *str = @"· 个人、班级、学校信息；\n· 作业记录；\n· 学习记录；\n· 交易记录。";
        NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
        style.lineSpacing = 5;
        NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithString:str];
        [att addAttributes:@{NSParagraphStyleAttributeName:style} range:NSMakeRange(0, str.length)];
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(16,12,bgView.width - 32,18);
        label.numberOfLines = 0;
        [bgView addSubview:label];
        label.textColor = rgba(114, 122, 142, 1);
        label.font = RFontWithSize(13);
        label.attributedText = att;
        label.textAlignment = NSTextAlignmentLeft;
        [label sizeToFit];
        [bgView addSubview:label];
        
        UILabel *labelT = [[UILabel alloc] init];
        labelT.frame = CGRectMake(48,bgView.bottom + 12,LTScreenWidth - 96,17);
        labelT.textColor = rgba(153, 153, 153, 1);
        labelT.font = RFontWithSize(12);
        labelT.text = @"注意，注销账号后以下信息将被清空并无法找回";
        labelT.textAlignment = NSTextAlignmentLeft;
       
        [_tableFootorView addSubview:labelT];
        [_tableFootorView addSubview:bgView];
      
        _tableFootorView.height = labelT.bottom;
        
    }
    
    return _tableFootorView;
    
}

-(UIView *)tableHeaderView
{
    if (!_tableHeaderView)
    {
        _tableHeaderView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, LTScreenWidth, 250)];
        
        _tableHeaderView.backgroundColor = LTClearColor;
       
        UIImageView *headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake((LTScreenWidth - 140)/2.0, 64, 140, 140)];
        headerImageView.image = IMAGENAMED(@"ic_account_cancellation");
        [_tableHeaderView addSubview:headerImageView];
    
        UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(32, headerImageView.bottom + 20, LTScreenWidth - 64, 22)];
        titleLabel.font = MFontWithSize(16);
        titleLabel.text = @"请联系客服注销账号";
        [titleLabel setTextAlignment:NSTextAlignmentCenter];
        titleLabel.textColor = LTTextBlack;
        [_tableHeaderView addSubview:titleLabel];
        
        UILabel * titleLabelSub = [[UILabel alloc] initWithFrame:CGRectMake(32, titleLabel.bottom + 4, LTScreenWidth - 64, 22)];
        titleLabelSub.font = MFontWithSize(16);
        titleLabelSub.text = @"400-0755-033";
        [titleLabelSub setTextAlignment:NSTextAlignmentCenter];
        titleLabelSub.textColor = LTTextBlack;
        [_tableHeaderView addSubview:titleLabel];
        [_tableHeaderView addSubview:titleLabelSub];
        _tableHeaderView.height = titleLabelSub.bottom;
        
    }
    
    return _tableHeaderView;
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

